home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 3.8 KB | 125 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: InsrtCmd.cpp
- // Release Version: $ ODF 1 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "ODFDraw.hpp"
-
- #ifndef INSERTCMD_H
- #include "InsrtCmd.h"
- #endif
-
- #ifndef DRAWSEL_H
- #include "DrawSel.h"
- #endif
-
- #ifndef DRAWFRM_H
- #include "DrawFrm.h"
- #endif
-
- #ifndef DRAWCONT_H
- #include "DrawCont.h"
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfdrawcommand
- #endif
-
-
- FW_DEFINE_AUTO(CDrawInsertCommand)
-
- //========================================================================================
- // CDrawInsertCommand
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand constructor
- //----------------------------------------------------------------------------------------
-
- CDrawInsertCommand::CDrawInsertCommand(Environment *ev,
- CDrawFrame* frame,
- const FW_PFileSpecification& fileSpec,
- CDrawSelection* selection,
- FW_Boolean canUndo) :
- FW_CInsertCommand(ev, frame, fileSpec, canUndo),
- fUndoContent(NULL),
- fDrawSelection(selection)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand destructor
- //----------------------------------------------------------------------------------------
-
- CDrawInsertCommand::~CDrawInsertCommand()
- {
- FW_START_DESTRUCTOR
- delete fUndoContent;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand::PreCommand
- //----------------------------------------------------------------------------------------
-
- void CDrawInsertCommand::PreCommand(Environment *ev)
- {
- fDrawSelection->CloseSelection(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand::CommandDone
- //----------------------------------------------------------------------------------------
-
- void CDrawInsertCommand::CommandDone(Environment *ev)
- {
- fDrawSelection->CenterSelection(ev, GetFrame(ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand::SaveRedoState
- //----------------------------------------------------------------------------------------
-
- void CDrawInsertCommand::SaveRedoState(Environment *ev)
- {
- FW_ASSERT(fUndoContent == NULL);
- fUndoContent = FW_NEW(CDrawUndoContent, (ev, fDrawSelection->GetDrawPart(), fDrawSelection));
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand::FreeRedoState
- //----------------------------------------------------------------------------------------
-
- void CDrawInsertCommand::FreeRedoState(Environment* ev)
- {
- fUndoContent->DeleteSavedShapes(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand::UndoIt
- //----------------------------------------------------------------------------------------
-
- void CDrawInsertCommand::UndoIt(Environment *ev)
- {
- fUndoContent->RemoveShapeSelection(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawInsertCommand::RedoIt
- //----------------------------------------------------------------------------------------
-
- void CDrawInsertCommand::RedoIt(Environment *ev)
- {
- fUndoContent->RestoreShapeSelection(ev);
- }
-